package com.zjq.security.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @User zhangjiaqi
 * @Project security
 * @Package com.zjq.security.controller
 * @Date 2022/3/28 19:39
 */
@RestController
@RequestMapping("/users")
public class UserController {

    @PreAuthorize("hasAnyAuthority('users:add')")//在方法之前先鉴定,告诉security当前地址需要什么权限
    @RequestMapping("/add")
    public String add() {
        return "add";
    }

    @PreAuthorize("hasAnyAuthority('users:info')")//在方法之前先鉴定,告诉security当前地址需要什么权限
    @RequestMapping("/info")
    public String info() {
        return "info";
    }

    @PreAuthorize("hasAnyAuthority('users:edit')")//在方法之前先鉴定,告诉security当前地址需要什么权限
    @RequestMapping("/edit")
    public String edit() {
        return "edit";
    }






}
